Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix thread_local to actually be static #53

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

jamesbornholt
Copy link
Member

Not tally sure what's going on here, but I've seen tests where a single
thread_local somehow got multiple versions of a LocalKey (one per
callsite). My guess is that we need to make them static instead of
just const, but I don't really understand why. Making this change at
least forces us to also implement Send/Sync for LocalKey, whereas
before the compiler didn't ask for it, which suggests the LocalKeys
weren't being shared like we expected them to be.

I wasn't able to write a test that actually exposed the buggy behavior,
though -- I can only reproduce it in a release build, which suggests it
might be a codegen problem or something.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Not tally sure what's going on here, but I've seen tests where a single
`thread_local` somehow got multiple versions of a `LocalKey` (one per
callsite). My guess is that we need to make them `static` instead of
just `const`, but I don't really understand why. Making this change at
least forces us to also implement Send/Sync for `LocalKey`, whereas
before the compiler didn't ask for it, which suggests the `LocalKey`s
weren't being shared like we expected them to be.

I wasn't able to write a test that actually exposed the buggy behavior,
though -- I can only reproduce it in a release build, which suggests it
might be a codegen problem or something.
@jorajeev jorajeev merged commit 31f169d into awslabs:main Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants